﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ArgusLight.Fractals2D.ComplexFractalColoring.EscapeTime
{
	public abstract class HSVColoring : ComplexFractalColoring.PeriodicColoring
	{
		public override void PostCalculation()
		{
			base.PostCalculation();
			for (int x = 0; x < this.fractalParameter.PixelWidth; x++)
			{
				for (int y = 0; y < this.fractalParameter.PixelHeight; y++)
				{
					int i = this.data.iterations[x, y];
					if (i < 1 || i >= this.fractalParameter.Iterations)
						continue;

					if (i < this.data.ArgumentInterval.Min)
						this.data.ArgumentInterval.Min = i;
					if (i > this.data.ArgumentInterval.Max)
						this.data.ArgumentInterval.Max = i;
				}
			}
		}

		protected override double GetFrequency()
		{
			return this.parameter.NumberOfColorPeriods * 360 / this.data.ArgumentInterval.Length;
		}
	}
}
